package mz.mobileservices.uem;

//import java.util.LinkedList;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.ArrayList;

public class MenuAdapter extends BaseAdapter
{
	ArrayList<MenuServicos> mLista;
	Context mContext;
	
	public MenuAdapter(Context ctx, ArrayList<MenuServicos> l) 
	{
		mContext = ctx;
		mLista = l;
	}
	
	public int getCount() 
	{ 
		return mLista.size();
	}

	public Object getItem(int arg0) 
	{ 
		return mLista.get(arg0); 
	}

	public long getItemId(int position) 
	{ 
		return -1;
	}

	public View getView(int position, View convertView, ViewGroup parent) 
	{	
		if(convertView == null)
		{
			LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			convertView = li.inflate(R.layout.item_de_menu, null);
		}
		
		// nome
		TextView t1 = (TextView) convertView.findViewById(R.id.nome_menu);
		t1.setText(mLista.get(position).mNome);
		
		// descricao
		TextView t2 = (TextView) convertView.findViewById(R.id.descricao_menu);
		t2.setText(mLista.get(position).mDescricao);
		
		return convertView;
	}
}